/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.component.gateway.dianlan.protocol.passive;

import info.peigen.hotpot.common.core.enums.NetworkConnectType;
import info.peigen.hotpot.common.core.enums.StubType;
import info.peigen.hotpot.common.core.enums.TelecomOperatorsType;
import info.peigen.hotpot.component.gateway.dianlan.annotations.DianlanProtocol;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;
import lombok.experimental.SuperBuilder;

import static info.peigen.hotpot.component.gateway.dianlan.annotations.DianlanProtocol.DianlanProtocolDataType.*;

/**
 * <b>(DianlanLogin)</b>
 * <p>
 * 充电桩登录认证
 * 帧类型码 0x01
 * 序列号域 0000
 * 数据长度 34
 * 帧校验域 675A
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2022/8/11
 */
@SuperBuilder
@Data
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
@Accessors(chain = true)
public class DianlanLogin {
    /** 桩编码 */
    @DianlanProtocol(length = 7, start = 0, end = 7, dataType = BCD)
    String               stubNo;
    /** 桩类型 */
    @DianlanProtocol(length = 1, start = 7, end = 8, dataType = ENUM)
    StubType             stubType;
    /** 充电枪数量 */
    @DianlanProtocol(length = 1, start = 8, end = 9, dataType = BIN)
    Integer              chargingCount;
    /** 通信协议版本 */
    @DianlanProtocol(length = 1, start = 8, end = 9, dataType = BIN)
    String               protocolVersion;
    /** 程序版本 */
    @DianlanProtocol(length = 8, start = 9, end = 17, dataType = ASCII)
    String               programVersion;
    /** 网络链接类型 */
    @DianlanProtocol(length = 1, start = 17, end = 18, dataType = ENUM)
    NetworkConnectType   networkConnectType;
    /** Sim 卡 */
    @DianlanProtocol(length = 10, start = 18, end = 28, dataType = BCD)
    String               simNo;
    /** 运营商 */
    @DianlanProtocol(length = 1, start = 28, end = 29, dataType = ENUM)
    TelecomOperatorsType telecomOperatorsType;
}